package users.dawn;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import users.dawn.beans.Config;


@SuppressWarnings("javadoc")
public class DawnMainApp
{

	public DawnMainApp()
	{
	}


	public static void main(String[] args)
	{
		final ApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "users/dawn/dawn.main.xml" });
		((AbstractApplicationContext) context).registerShutdownHook();
		
		context.containsBean("config");

		runJan18Lab(context);

		System.out.println("Done! ");

	}
	
	public static Config retrieveConfig(ApplicationContext context) 
	{
		return context.getBean("config", Config.class);
		
	}

	private static void runJan18Lab(ApplicationContext context) {
	
		Config config1 = retrieveConfig(context);
		System.out.println ("#1 Config.params:\n" + config1);
		
		config1.setMaxCacheSize(9999);
		
		Config config2 = retrieveConfig(context);
		System.out.println ("#2 Config.params:\n" + config2);
	}
	
/*	private static void runDecLab(ApplicationContext context) {
		Config config1 = retrieveConfig(context);
		config1.setMaxCacheSize(99999);
		System.out.println ("#1 Config.params:\n" + config1);

		Config config2 = retrieveConfig(context);
		System.out.println ("#2 Config.params:\n" + config2);
	}*/
}
